package com.example.demotest.service.Impl;

import com.example.demotest.dao.Impl.DeptDaoImpl;
import com.example.demotest.javaBean.dept;
import com.example.demotest.mapper.DeptMapper;
import com.example.demotest.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @Auther:lele
 * @Date:2025/4/1
 */
@Service
public class addDeptServiceImpl implements DeptService {
    @Autowired
    DeptDaoImpl deptDao;
    @Autowired
    DeptMapper deptMapper;
    @Override
    public String adddeptService(String str) {
        if (str.equals("用户来请求了")){
            String result = deptDao.addDeptDao("请添加数据");
            return result;

        }
        return null;
    }

    public List<dept> selectAllService(){
        return deptMapper.selectAllDao();
    }

    public void delService(Integer id){
        deptMapper.delDao(id);
    }

    public void addService(dept dept){
        dept.setCreateTime(LocalDateTime.now());
        dept.setUpdateTime(LocalDateTime.now());
        deptMapper.addDao(dept);
    }
    public dept getService(Integer id){
        return deptMapper.getDao(id);
    }

    public void updataService(dept dept){
        deptMapper.updateDao(dept);
    }
}
